from selenium import  webdriver
from time import sleep
from selenium.webdriver.common.by import By     #  元素定位
from selenium.webdriver.common.keys import Keys

# 打开浏览器
driver = webdriver.Edge()
# 窗口最大化
driver.maximize_window()
# 双击打开京东页面
driver.get('https://www.jd.com/')
sleep(2)
# 点击请登录
# driver.find_element(By.XPATH, '/html/body/div[1]/div[3]/div/ul[1]/li[3]/a[1]/span[2]').click()
driver.find_element(By.CLASS_NAME, 'style-red').click()
# driver.find_element(By.CSS_SELECTOR, '#ttbar-login > a.link-login > span.style-red').click()
sleep(2)

# 点击密码登录
driver.find_element(By.XPATH, '/html/body/div/div/div[2]/div[2]/div[1]/div/div[1]/div[1]').click()
sleep(2)
# 输入手机号
driver.find_element(By.CLASS_NAME, 'itxt').send_keys('15985645480')
sleep(2)
# 输入密码：
driver.find_element(By.NAME, 'nloginpwd').send_keys('gw09092431')
sleep(2)
# 点击登录
driver.find_element(By.XPATH, '/html/body/div/div/div[2]/div[2]/div[1]/div/div[2]/div/form/div[4]').click()
sleep(10)




# # 关闭浏览器
# driver.quit()

